package main

import "fmt"

func main() {
	c := 5
	k := 5
	num := 1
	var b [100][100]int
	left := 0
	right := c - 1
	top := 0
	bottom := k - 1
	for {
		if num == c*k {
			b[c/2][k/2] = c * k
			break
		} else {
			for i := left; i <= right; i++ {

				b[top][i] = num
				num += 1
			}
			top += 1
			for i := top; i <= bottom; i++ {
				b[i][right] = num
				num += 1
			}
			right -= 1
			if top <= bottom {
				for i := right; i >= left; i-- {
					b[bottom][i] = num
					num += 1
				}
				bottom -= 1
			}
			if left <= right {
				for i := bottom; i >= top; i-- {
					b[i][left] = num
					num += 1
				}
				left += 1
			}
		}
	}
	for i := 0; i < c; i++ {
		{
			for j := 0; j < k; j++ {
				fmt.Printf("%d ", b[i][j])
			}
			fmt.Println()
		}
	}
}
